//
//  JX_WebView.h
//  WebViewTest
//
//  Created by 李珈旭 on 2017/1/19.
//  Copyright © 2017年 jiaxuLI. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <WebKit/WebKit.h>

typedef void(^WebViewGetUrlBlock)(NSString *url);

@interface JX_WebView : WKWebView<WKNavigationDelegate>

@property (nonatomic,copy)void(^does)();
@property (nonatomic,copy)void(^start)(WKWebView *webview,WKNavigation *navigation);
@property (nonatomic,copy)void(^fail)(WKWebView *webview,WKNavigation *navigation);
@property (nonatomic,copy)void(^finish)(WKWebView *webview,WKNavigation *navigation);


- (void)getJumpUrl:(WebViewGetUrlBlock)block;


/**
 替换对应的URL 并加载新的URL

 @param url 需要替换的URL
 @param toUrl 需要加载的新URL
 @param does 事件回调
 */
-(void)replece:(NSString *)url To:(NSString *)toUrl Do:(void(^)())does;


/**
 检测对应URL 并加载

 @param url 需要检测的URL
 @param does 事件回调
 */
-(void)check:(NSString *)url Do:(void(^)())does;

/**
 拦截对应URL 并停止加载

 @param url 需要拦截的url
 @param does 事件回调
 */
-(void)intercept:(NSString *)url Do:(void(^)())does;

/**
 包含对应字符 并停止加载
 warning:确保徐拦截的字符不重复 且在别的URL中不存在

 @param str 包含的字符
 @param does 事件回调
 */
-(void)contains:(NSString *)str Do:(void(^)())does;
/**
 webview的加载开始 完成 失败代理

 @param start 开始加载
 @param finish 完成加载
 @param fail 加载失败
 */
-(void)webViewLoadStart:(void(^)(WKWebView *webview,WKNavigation *navigation))start Finish:(void(^)(WKWebView *webview,WKNavigation *navigation))finish Fail:(void(^)(WKWebView *webview,WKNavigation *navigation))fail;

// 只能使用指定的类方法实例化
+ (instancetype)new NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;

@end
